package com.study.www.demo.config;

import com.study.www.demo.Application;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.springframework.boot.web.servlet.ServletComponentScan;

import javax.annotation.PostConstruct;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * @author : Administrator.zhuyanpeng
 * @date : 2019/11/15 - 16:35
 */
@Slf4j
@WebListener
@ServletComponentScan("com.study.www.demo.web")
public class Demo2Listener implements HttpSessionListener {

    public Demo2Listener() {
        log.warn("Listener 的 constructor ;启动时间=>"+new DateTime().toString(Application.DATEFORMAT));
    }

    @PostConstruct
    public void postConstruct(){
        log.warn("Listener 的 postConstruct ;启动时间=>"+new DateTime().toString(Application.DATEFORMAT));
    }

    @Override
    public void sessionCreated(HttpSessionEvent se) {
        log.warn("Listener 的 sessionCreated ;启动时间=>"+new DateTime().toString(Application.DATEFORMAT));
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        log.warn("Listener 的 sessionDestroyed ;启动时间=>"+new DateTime().toString(Application.DATEFORMAT));
    }
}
